package com.richest.api.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.richest.api.dao.DiningTableMapper;
import com.richest.api.service.IDiningTableService;
import com.richest.bean.DiningTableBean;

/**
 * 
 * @author zhaohongchao 2019年3月18日 上午11:09:37
 * @email 70375739@qq.com
 */
@Service
public class DiningTableServiceImpl implements IDiningTableService {
	@Autowired
	private DiningTableMapper diningTableMapper;

	@Override
	public void updateStatus(Long dining_table_id, Integer status, String status_name, Date begin_time, Date end_time) {
		DiningTableBean diningTableBean = new DiningTableBean();
		diningTableBean.setDining_table_id(dining_table_id);
		diningTableBean.setStatus(status);
		diningTableBean.setStatus_name(status_name);
		if (null != begin_time) {
			diningTableBean.setBegin_time(begin_time);
		}
		if (null != end_time) {
			diningTableBean.setEnd_time(end_time);
		}

		diningTableMapper.updateStatus(diningTableBean);
	}

	@Override
	public DiningTableBean getNext(Long admartId) {
		return diningTableMapper.getNext(admartId);
	}

	@Override
	public DiningTableBean selectOne(DiningTableBean diningTableBean) {
		return diningTableMapper.selectOne(diningTableBean);
	}
}
